import java.util.UUID;
public class FileRename {
    public static void main(String[] args){
        String filePath = "C:\\Users\\User\\Documents\\example.txt";
        //获取后缀名
        String suffix = filePath.substring(filePath.lastIndexOf("."));
        //生成新的文件名
        String newFileName = UUID.randomUUID().toString() + suffix;
        System.out.println(newFileName);
        System.out.println(suffix);
    }
}
